<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title> 4-3 多重判断（if..else嵌套语句）</title>
    <link rel="stylesheet" type="text/css" href="../../../css/style.css"/>
    <style type="text/css">
    </style>

    <script type="text/javascript">
        function age() {
            //var myage = 99;   //赵红的年龄为99
            var myage = document.getElementById("div1").value; //获得text的值
            if (myage <= 44) {
                document.write("青年");
            }
            else if (myage <= 59) {
                document.write("中年人");
            }
            else if (myage <= 89) {
                document.write("老年人");
            }
            else {
                document.write("长寿老年人");
            }
        }
    </script>
</head>

<body>
<div align="center">
    <p><a href="../../index.php#jsjjp" class="fontSize" title="点击进入该目录">目录</a></p>
</div>

<input id="div1" type="text" name="grade"></br>
<input type="button" value="还是小伙子？" onclick="age()">

<script type="text/javascript">

</script>

</body>
</html>
